<template>
  <div>
      <p>外键：<input type="text" v-model="f"></p>
      <p>图片：<input type="file" id="img"></p>
      <p>简介：<input type="text" v-model="js"></p>
      <p><button @click="add">添加</button></p>
  </div>
</template>

<script>
import axios from 'axios'
export default {
    data(){
        return{
            f:'',
            js:''
        }
    },
    methods:{
        add(){
            let fdata = new FormData()
            fdata.append("f",this.f)
            fdata.append("img",document.getElementById("img").files[0])
            fdata.append("js",this.js)
            axios({
                url:'http://127.0.0.1:8000/zhu/zi2/',
                method:'post',
                data:fdata
            }).then(res=>{
                console.log(res.data)
            })
        }
        
    }
}
</script>

<style>

</style>